/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kreig133.spine.builder;

import com.kreig133.builder.AbstractDirector;
import com.kreig133.spine.simplemodel.SimpleExperiment;
import com.kreig133.xml.XmlParser;
import java.io.File;

/**
 *
 * @author C.C.-fag
 */
public class ExperimentBuildDirector extends AbstractDirector<Object, SimpleExperiment> {

    public ExperimentBuildDirector(Object parametrs) {
        super(null, parametrs);
    }

    @Override
    public SimpleExperiment construct() {
        switch (type) {
            case XML:
                XmlParser expParser = XmlParser.createXmlParser(XmlParser.EXPERIMENT);
                expParser.parseXML((File)parametrs);
                ExperimentBuilder expBuilder = new ExperimentBuilder(expParser.getParametrsForBuild());
                expBuilder.createExperiment();
                expBuilder.createEvents();
                return expBuilder.getBuildedExperiment();
        }
        return  null;

    }
}
